import request from "../utils/request"
//获取token
export const localLogin = async (data: object) => {
  return await request.post(`/Login`, data);
}
//请求登录页面
export const gotoLogin = () => {
  return request.get(`/Login`);
}
//获取TraveAllowance页面
export const GetTraveAllowanceList = (data: any) => {
  return request.post(`/TravelAllowance/getTraveAllowanceList`, data);
}
//生成TraveAllowance页面
export const GenerateTraveAllowance = async (data: any) => {
  var result = await request.post(`/TravelAllowance`, data);
  return result;
}
export const GetTraveAllowanceDetail = async (data: any) => {
  return await request.get(`/TravelAllowance/` + data);
}

export const SaveTravelAllowanceDetail = async (data: any) => {
  return await request.post(`/TravelAllowanceDetail`, data);
}

export const PutTravelAllowanceDetail = (data: any) => {
  return request.put(`/TravelAllowanceDetail`, data);
}

export const DeleteTravelAllowanceDetail = (data: any) => {
  return request.delete(`/TravelAllowanceDetail?id=` + data.travelAllowanceDetailId, {id: data.travelAllowanceDetailId});
}

export const GetTerritoryList = () => {
  return request.get("/Territory");
}
export const GetTerritoryListByParentId = async (id: string) => {
  return await request.get("/Territory/" + id);
}
export const GetTerritoryListById = (id: string) => {
  return request.get("/Territory/" + id);
}

export const GetClientPicker = (data: any) => {
  return request.post(`/ClientPicker`, data);
}
export const GetJobPicker = (data: any) => {
  return request.post(`/ClientPicker/getJobList`, data);
}
export const GetProjectPicker = (data: any) => {
  return request.post(`/ClientPicker/getProjectList`, data);
}
export const GetCityDailyAllowanceByTerritory = async (id: any) => {
  return await request.get('/CityDailyAllowance/' + id)
}
export const UploadFile = async (data: any) => {
  var result = await request.formPost(`/Attachment`, data);
  return result;
}
export const SaveUploadFile = (data: any) => {
  return request.post(`/Attachment/Add`, data);
}
export const GetUploadFile = (data: any) => {
  return request.get(`/Attachment/` + data);
}
export const DeleteUploadFileODB = (data: any) => {
  return request.post(`/Attachment/DeleteDB/` + data);
}
export const DeleteUploadFile = (data: any) => {
  return request.delete(`/Attachment/` + data);
}
export const GetStaffBank = async (data: any) => {
  return await request.post(`/StaffBank`, data);
}
export const GetAuditHistory = (id: string) => {
  return request.get(`/TravelAllowanceHistoryLog/` + id);
}
export const PutTravelAllowance = (data: any) => {
  return request.put(`/TravelAllowance`, data);
}
export const WorkFlowHanld = (data: any) => {
  return request.post('/Workflow', data);
}
export const WorkflowHandleOperation = (data: any) => {
  return request.get('/Workflow/' + data);
}

export const Login = (data: any) => {
  return request.post('/base/login', data);
}

export const Register = (data: any) => {
  return request.post('/user/register', data)
}
export const GetUserList = (data: any) => {
  return request.post('/user/getUserList', data)
}
